/**
 * 
 */
package cn.edu.cqu.bysj.wm.gui.component;

import javax.swing.JPanel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JTextPane;

import cn.edu.cqu.bysj.wm.gui.ImageButton;

import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.awt.Color;
import java.awt.SystemColor;

/**
 * @author Meng
 *
 */
public class GNSQResultContent extends JPanel {
	private JPanel communityRows;
	
	private JPanel depthQRows;
	private JTextPane totalTime;
	private JTextPane initialTime;
	private JTextPane iterationTime;
	private JTextPane calculateBetweenessTime;
	private JTextPane totalDepth;
	private JTextPane maxDepth;
	private JTextPane maxQValue;
	/**
	 * create gn algorithm result content
	 */
	public GNSQResultContent() {
		
		communityRows = new JPanel();
		
		depthQRows = new JPanel();
		
		JPanel panel_2 = new JPanel();
		
		JPanel panel_3 = new JPanel();
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.TRAILING)
				.addGroup(groupLayout.createSequentialGroup()
					.addComponent(depthQRows, GroupLayout.DEFAULT_SIZE, 505, Short.MAX_VALUE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(panel_3, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
				.addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 1101, Short.MAX_VALUE)
				.addComponent(communityRows, GroupLayout.DEFAULT_SIZE, 1101, Short.MAX_VALUE)
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(communityRows, GroupLayout.DEFAULT_SIZE, 244, Short.MAX_VALUE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(panel_3, 0, 0, Short.MAX_VALUE)
						.addComponent(depthQRows, GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE))
					.addGap(18))
		);
		depthQRows.setLayout(new BorderLayout(0, 0));
		communityRows.setLayout(new BorderLayout(0, 0));
		
		JLabel lblNewLabel_4 = new JLabel("Total Time");
		lblNewLabel_4.setForeground(new Color(65, 105, 225));
		
		totalTime = new JTextPane();
		totalTime.setBackground(SystemColor.menu);
		totalTime.setEditable(false);
		
		JLabel lblNewLabel_5 = new JLabel("Initial Time");
		lblNewLabel_5.setForeground(new Color(65, 105, 225));
		
		initialTime = new JTextPane();
		initialTime.setBackground(SystemColor.menu);
		initialTime.setEditable(false);
		
		JLabel lblNewLabel_6 = new JLabel("Iteration Time");
		lblNewLabel_6.setForeground(new Color(65, 105, 225));
		
		iterationTime = new JTextPane();
		iterationTime.setBackground(SystemColor.menu);
		iterationTime.setEditable(false);
		
		JLabel lblNewLabel_7 = new JLabel("Calculate Betweenness Time");
		lblNewLabel_7.setForeground(new Color(65, 105, 225));
		
		calculateBetweenessTime = new JTextPane();
		calculateBetweenessTime.setBackground(SystemColor.menu);
		calculateBetweenessTime.setEditable(false);
		GroupLayout gl_panel_2 = new GroupLayout(panel_2);
		gl_panel_2.setHorizontalGroup(
			gl_panel_2.createParallelGroup(Alignment.LEADING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addContainerGap()
					.addComponent(lblNewLabel_4, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(totalTime, GroupLayout.PREFERRED_SIZE, 81, GroupLayout.PREFERRED_SIZE)
					.addGap(39)
					.addComponent(lblNewLabel_5, GroupLayout.PREFERRED_SIZE, 96, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(initialTime, GroupLayout.PREFERRED_SIZE, 95, GroupLayout.PREFERRED_SIZE)
					.addGap(34)
					.addComponent(lblNewLabel_6, GroupLayout.PREFERRED_SIZE, 112, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(iterationTime, GroupLayout.PREFERRED_SIZE, 89, GroupLayout.PREFERRED_SIZE)
					.addGap(83)
					.addComponent(lblNewLabel_7, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE)
					.addPreferredGap(ComponentPlacement.RELATED)
					.addComponent(calculateBetweenessTime, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(47, Short.MAX_VALUE))
		);
		gl_panel_2.setVerticalGroup(
			gl_panel_2.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_panel_2.createSequentialGroup()
					.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
						.addGroup(gl_panel_2.createSequentialGroup()
							.addContainerGap()
							.addComponent(initialTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
						.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
							.addGroup(gl_panel_2.createSequentialGroup()
								.addContainerGap()
								.addComponent(iterationTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.addGroup(gl_panel_2.createSequentialGroup()
								.addContainerGap()
								.addComponent(totalTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
							.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
								.addGroup(gl_panel_2.createSequentialGroup()
									.addContainerGap()
									.addComponent(calculateBetweenessTime, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
								.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
									.addGroup(gl_panel_2.createSequentialGroup()
										.addContainerGap()
										.addComponent(lblNewLabel_5))
									.addGroup(gl_panel_2.createSequentialGroup()
										.addGap(27)
										.addGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING, false)
											.addComponent(lblNewLabel_7)
											.addComponent(lblNewLabel_6)
											.addComponent(lblNewLabel_4)))))))
					.addContainerGap())
		);
		panel_2.setLayout(gl_panel_2);
		
		JLabel lblNewLabel_2 = new JLabel("Which Depth:");
		lblNewLabel_2.setForeground(new Color(255, 69, 0));
		
		JLabel lblNewLabel = new JLabel("Max Q Value:");
		lblNewLabel.setForeground(new Color(255, 69, 0));
		
		JButton showTreeBtn =ImageButton.makeNavigationButton("tree.png", "Run", "Run", "Run", null,60,60);
		//JButton showTreeBtn =new JButton("show tree");
		showTreeBtn.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				try {
					Process process = Runtime.getRuntime().exec("E:/专业相关/neoclipse-1.7-win32.win32.x86/neoclipse-1.7-win32.win32.x86/neoclipse-1.7/neoclipse.exe");
					process.waitFor();
				} catch (IOException e1) {
					e1.printStackTrace();
				} catch (InterruptedException e2) {
					e2.printStackTrace();
				}
				
			}
		});
		
		maxQValue = new JTextPane();
		maxQValue.setBackground(SystemColor.menu);
		maxQValue.setEditable(false);
		
		maxDepth = new JTextPane();
		maxDepth.setBackground(SystemColor.menu);
		maxDepth.setEditable(false);
		
		JLabel lblNewLabel_1 = new JLabel("Total Depth:");
		lblNewLabel_1.setForeground(new Color(106, 90, 205));
		
		totalDepth = new JTextPane();
		totalDepth.setBackground(SystemColor.menu);
		totalDepth.setEditable(false);
		
		JLabel lblNewLabel_3 = new JLabel("Show Hierarchy Tree");
		lblNewLabel_3.setForeground(new Color(60, 179, 113));
		GroupLayout gl_panel_3 = new GroupLayout(panel_3);
		gl_panel_3.setHorizontalGroup(
			gl_panel_3.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_panel_3.createSequentialGroup()
					.addGap(42)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
						.addComponent(lblNewLabel_2)
						.addComponent(lblNewLabel_1, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
						.addComponent(lblNewLabel))
					.addPreferredGap(ComponentPlacement.RELATED)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
						.addGroup(gl_panel_3.createSequentialGroup()
							.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
								.addGroup(gl_panel_3.createSequentialGroup()
									.addGap(234)
									.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE))
								.addComponent(totalDepth, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
							.addGap(18)
							.addComponent(showTreeBtn))
						.addComponent(maxQValue, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE)
						.addComponent(maxDepth, GroupLayout.PREFERRED_SIZE, 208, GroupLayout.PREFERRED_SIZE))
					.addGap(31))
		);
		gl_panel_3.setVerticalGroup(
			gl_panel_3.createParallelGroup(Alignment.TRAILING)
				.addGroup(gl_panel_3.createSequentialGroup()
					.addGap(42)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.TRAILING)
						.addComponent(lblNewLabel)
						.addComponent(maxQValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(33)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
						.addComponent(lblNewLabel_2)
						.addComponent(maxDepth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(35)
					.addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
						.addComponent(lblNewLabel_1)
						.addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
							.addComponent(lblNewLabel_3, GroupLayout.PREFERRED_SIZE, 31, GroupLayout.PREFERRED_SIZE)
							.addComponent(showTreeBtn, GroupLayout.PREFERRED_SIZE, 85, GroupLayout.PREFERRED_SIZE))
						.addComponent(totalDepth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addContainerGap(35, Short.MAX_VALUE))
		);
		panel_3.setLayout(gl_panel_3);
		setLayout(groupLayout);
	}
	
	public JPanel getCommunityRows() {
		return communityRows;
	}
	public void setCommunityRows(JPanel communityRows) {
		this.communityRows = communityRows;
	}
	public JPanel getDepthQRows() {
		return depthQRows;
	}
	public void setDepthQRows(JPanel depthQRows) {
		this.depthQRows = depthQRows;
	}
	public JTextPane getTotalTime() {
		return totalTime;
	}
	public void setTotalTime(JTextPane totalTime) {
		this.totalTime = totalTime;
	}
	public JTextPane getInitialTime() {
		return initialTime;
	}
	public void setInitialTime(JTextPane initialTime) {
		this.initialTime = initialTime;
	}
	public JTextPane getIterationTime() {
		return iterationTime;
	}
	public void setIterationTime(JTextPane iterationTime) {
		this.iterationTime = iterationTime;
	}
	public JTextPane getCalculateBetweenessTime() {
		return calculateBetweenessTime;
	}
	public void setCalculateBetweenessTime(JTextPane calculateBetweenessTime) {
		this.calculateBetweenessTime = calculateBetweenessTime;
	}
	public JTextPane getTotalDepth() {
		return totalDepth;
	}
	public void setTotalDepth(JTextPane totalDepth) {
		this.totalDepth = totalDepth;
	}
	public JTextPane getMaxDepth() {
		return maxDepth;
	}
	public void setMaxDepth(JTextPane maxDepth) {
		this.maxDepth = maxDepth;
	}
	public JTextPane getMaxQValue() {
		return maxQValue;
	}
	public void setMaxQValue(JTextPane maxQValue) {
		this.maxQValue = maxQValue;
	}
}
